package com.demo.common.log.config;

import com.demo.common.log.interceptor.TraceIdInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @Author：DayDayUp
 * @Create：2023/4/12 10:04
 */
@Configuration
public class LogAutoConfiguration implements WebMvcConfigurer {

    @Bean
    public TraceIdInterceptor traceIdInterceptor(){
        return new TraceIdInterceptor();
    }


    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(traceIdInterceptor()).addPathPatterns("/**");
    }
}
